-- bine_addon
-- create by panyl
-- 魔藤加成属性

return {
    apply = function(prop, baseValue)
        return baseValue + prop[3];
    end,

    record = function(target, prop, path)
        assert(target.type == OBJECT_TYPE_BINE, "魔藤才该有的属性。");

        -- 无论魔藤是否死亡，都起效
        local bineAddon = ME.user.dbase:query("bine_addon", {});
        bineAddon[prop[2]] = prop[3];

        ME.user.dbase:set("bine_addon", bineAddon);

        EventMgr.fire(event.USER_INFO_UPDATED, "bine_addon");

        return false;
    end
};
